package com.example.fireassistant_server.entity;

import lombok.Data;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.List;

@Entity
@Data
public class Company extends MarkerEntity{

    //单位所在省份
    private String province;
    //单位所在市
    @Column(name = "city_name")
    private String cityName;
    // 单位名称
    @Column(name = "company_name")
    private String companyName;

    // 单位所在点
    private BigDecimal latitude;

    private BigDecimal longitude;

    // 辖区半径
    private float radius;

    private String description;

    @ManyToMany(fetch = FetchType.EAGER)
    @Fetch(FetchMode.SUBSELECT)
    @JoinTable(name = "company_file", joinColumns = @JoinColumn(name = "company_id", referencedColumnName = "id"), inverseJoinColumns = @JoinColumn(name = "file_id", referencedColumnName = "id"))
    private List<File> Files;
}
